From 00f7c07c02f3cff1ed637ecdeffd0b9dd373e6ff Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Wed, 3 Dec 2014 04:11:33 +0000 Subject: [PATCH] content: Deprecate TitleIsCssOrJsPage and TitleIsWikitextPage hooks They're currently documented as a 'compatibility hook' in docs/contenthandler.txt. No longer used in any Wikimedia-hosted git repository. Superseded by the ContentHandlerDefaultModelFor hook. Change-Id: I212230da7d6080cf500f930d4aa5a9024959d5f9 --- RELEASE-NOTES-1.25 | 4 ++++ docs/hooks.txt | 6 ++++-- includes/Title.php | 4 ++-- includes/content/ContentHandler.php | 4 ++-- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/RELEASE-NOTES-1.25 b/RELEASE-NOTES-1.25 index 92e0a2c753..5d423a1c0d 100644 --- a/RELEASE-NOTES-1.25 +++ b/RELEASE-NOTES-1.25 @@ -250,6 +250,10 @@ changes to languages because of Bugzilla reports. fail for custom tokens registered only via the deprecated ApiTokensGetTokenTypes hook. The ApiQueryTokensRegisterTypes hook should be used for this to work. * Added wgRelevantArticleId to the client-side config, for use on special pages. +* Deprecated the TitleIsCssOrJsPage hook. Superseded by the + ContentHandlerDefaultModelFor hook since MediaWiki 1.21. +* Deprecated the TitleIsWikitextPage hook. Superseded by the + ContentHandlerDefaultModelFor hook since MediaWiki 1.21. == Compatibility == diff --git a/docs/hooks.txt b/docs/hooks.txt index a4e02c68fe..062a0c8fe8 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -2692,7 +2692,8 @@ that can be applied. $title: The title in question. &$types: The types of protection available. -'TitleIsCssOrJsPage': Called when determining if a page is a CSS or JS page. +'TitleIsCssOrJsPage': DEPRECATED! Use ContentHandlerDefaultModelFor instead. +Called when determining if a page is a CSS or JS page. $title: Title object that is being checked $result: Boolean; whether MediaWiki currently thinks this is a CSS/JS page. Hooks may change this value to override the return value of @@ -2713,7 +2714,8 @@ $result: Boolean; whether MediaWiki currently thinks this page is movable. Hooks may change this value to override the return value of Title::isMovable(). -'TitleIsWikitextPage': Called when determining if a page is a wikitext or should +'TitleIsWikitextPage': DEPRECATED! Use ContentHandlerDefaultModelFor instead. +Called when determining if a page is a wikitext or should be handled by separate handler (via ArticleViewCustom). $title: Title object that is being checked $result: Boolean; whether MediaWiki currently thinks this is a wikitext page. diff --git a/includes/Title.php b/includes/Title.php index f913859fdd..638da08581 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -1250,9 +1250,9 @@ class Title { # @note This hook is also called in ContentHandler::getDefaultModel. # It's called here again to make sure hook functions can force this - # method to return true even outside the mediawiki namespace. + # method to return true even outside the MediaWiki namespace. - wfRunHooks( 'TitleIsCssOrJsPage', array( $this, &$isCssOrJsPage ) ); + wfRunHooks( 'TitleIsCssOrJsPage', array( $this, &$isCssOrJsPage ), '1.25' ); return $isCssOrJsPage; } diff --git a/includes/content/ContentHandler.php b/includes/content/ContentHandler.php index ac41722307..9aa42dd65b 100644 --- a/includes/content/ContentHandler.php +++ b/includes/content/ContentHandler.php @@ -214,7 +214,7 @@ abstract class ContentHandler { } // Hook can force JS/CSS - wfRunHooks( 'TitleIsCssOrJsPage', array( $title, &$isCssOrJsPage ) ); + wfRunHooks( 'TitleIsCssOrJsPage', array( $title, &$isCssOrJsPage ), '1.25' ); // Is this a .css subpage of a user page? $isJsCssSubpage = NS_USER == $ns @@ -229,7 +229,7 @@ abstract class ContentHandler { $isWikitext = $isWikitext && !$isCssOrJsPage && !$isJsCssSubpage; // Hook can override $isWikitext - wfRunHooks( 'TitleIsWikitextPage', array( $title, &$isWikitext ) ); + wfRunHooks( 'TitleIsWikitextPage', array( $title, &$isWikitext ), '1.25' ); if ( !$isWikitext ) { switch ( $ext ) { -- 2.20.1